package com.tuniu.agents.common;

import java.util.List;

/**
 * Global variables for the entire project
 */
public class AgentsConstants {


    /**
     * Parameter names passed from the frontend
     */
    public static class FrontendParamKey {

        public static final String PARAM_ROOT_KEY = "c";

        public static final String CITY_KEY = "cn";

        /**
         * Client type
         */
        public static final String CLIENT_KEY = "ct";

        public static final String DEFAULT_VALUE_CITY_KEY = "上海";
        public static final int DEFAULT_VALUE_CITY_CODE = 2500;
        public static final int DEFAULT_CLIENT_TYPE = 200; // Default client is app

        // iosMP:32, androidMP:34
        public static final List<String> WECHAT_CLIENT_TYPE = List.of("32", "34");

        // ios:10, android:20
        public static final List<String> APP_CLIENT_TYPE = List.of("10", "20");

        /**
         * User's latitude
         */
        public static final String USER_LAT = "lat";

        /**
         * User's longitude
         */
        public static final String USER_LNG = "lng";

        /**
         * User's city name
         */
        public static final String USER_CITY = "ucn";

        /**
         * User's city code
         */
        public static final String USER_CITY_CODE = "cc";

        public static final String SUGGESTION_BUSINESS_TRIP = "suggestion.business.trip";
        public static final String SUGGESTION_FLIGHT_RECOMMENDATION = "suggestion.flight.recommendation";
        public static final String SUGGESTION_TRAIN_SCHEDULE = "suggestion.train.schedule";
        public static final String SUGGESTION_HOTEL_RECOMMENDATION = "suggestion.hotel.recommendation";
        public static final String SUGGESTION_SCENIC_SPOTS = "suggestion.scenic.spots";
        public static final String SUGGESTION_ORDER_QUERY = "suggestion.order.query";


    }

    /**
     * Keys for global session dimension environment variables of the Agent
     */
    public static class AgentsConversationEnvironmentKey {

        /**
         * Session ID
         */
        public static final String CONVERSATION_ID = "conversation_id";

        /**
         * Agent ID
         */
        public static final String AGENT_ID = "agent_id";

        /**
         * Last selected Selection Agent ID
         */
        public static final String LAST_SELECTION_AGENT_ID = "last_selection_agent_id";

        /**
         * Last selected TOOL ID
         */
        public static final String LAST_SELECTION_TOOL_ID = "last_selection_tool_id";

        /**
         * Customer ID
         */
        public static final String CUSTOMER_ID = "customer_id";

        /**
         * Current time
         */
        public static final String CURRENT_DATETIME = "current_datetime";

        /**
         * Global parameter: Departure city
         */
        public static final String PARAM_DEPARTURE_CITY_NAME = "departureCityName";

        /**
         * Global parameter: Departure city code
         */
        public static final String PARAM_DEPARTURE_CITY_CODE = "departureCityCode";

        /**
         * Global parameter: Arrival city
         */
        public static final String PARAM_ARRIVAL_CITY_NAME = "arrivalCityName";

        /**
         * Global parameter: Departure date
         */
        public static final String PARAM_DEPARTURE_DATE = "departureDate";

        /**
         * Main intent (history of all main intents)
         */
        public static final String MAIN_INTENT_HISTORY = "main_intent";

        /**
         * Secondary intent (history of all secondary intents)
         */
        public static final String POTENTIAL_INTENTS_HISTORY = "potential_intents";

        /**
         * Client type
         */
        public static final String CLIENT_TYPE = "client_type";

        /**
         * User's latitude
         */
        public static final String PARAM_USER_LAT = "user_lat";

        /**
         * User's longitude
         */
        public static final String PARAM_USER_LNG = "user_lng";

        /**
         * User's city code
         */
        public static final String PARAM_USER_CITY_CODE = "user_city_code";

        /**
         * User's city name
         */
        public static final String PARAM_USER_CITY_NAME = "user_city_name";

        /**
         * User's last message
         */
        public static final String USER_LAST_MESSAGE = "user_last_message";

        /**
         * Internationalization information
         */
        public static final String ACCEPT_LANGUAGE = "accept_language";

        /**
         * Trace ID for a single interface access flow
         */
        public static final String PARAM_TRACE_ID = "trace_id";

        /**
         * Information for the previous span ID
         */
        public static final String PARAM_SPAN_ID_COUNT = "span_id_count";

        /**
         * Information for the previous span ID
         */
        public static final String PARAM_PARENT_SPAN_ID = "parent_span_id";

        /**
         * Last request execution shortcut ID
         */
        public static final String COMMAND_LAST_ID = "command_last_id";

        /**
         * current request id
         */
        public static final String CURRENT_REQUEST_ID = "request_id";

    }

    /**
     * Agent Advisor value records
     */
    public static class AgentsAdvisorKey {

        /**
         * User message template
         */
        public static final String USER_MESSAGE_TEMPLATE = "user_message_template";

        /**
         * User message history
         */
        public static final String USER_MESSAGE_HIS = "user_message_his";

        /**
         * User's current conversation
         */
        public static final String USER_MESSAGE_CURRENT = "user_message_current";

        /**
         * Whether assistant message history is needed String
         * false: not needed
         * true: needed by default
         */
        public static final String ASSISTANT_MESSAGE_HISTORY_NEED = "assistant_message_history_need";

        /**
         * Whether user message history is needed String
         * false: not needed
         * true: needed by default
         */
        public static final String USER_MESSAGE_HISTORY_NEED = "user_message_history_need";

        /**
         * User requirement ID
         */
        public static final String USER_REQUIRE_ID = "user_require_id";

        /**
         * User itinerary ID
         */
        public static final String USER_ITINERARY_ID = "user_itinerary_id";

        /**
         * User requirement history
         */
        public static final String USER_REQUIRE_INFO = "user_require_info";


    }

    /**
     * This class contains constant keys used for agent response metadata.
     * @see org.springframework.ai.chat.metadata.ChatResponseMetadata
     */
    public static final class AgentResponseMetadataKey {

        /**
         * Constant for the metadata key representing the message type of the agent
         * @see com.tuniu.agents.message.AgentMessageType
         */
        public static final String METADATA_MESSAGE_TYPE_KEY = "agent_message_type";

        /**
         * Constant for the metadata key representing the agent ID, taken from AgentsConversationEnvironmentKey
         */
        public static final String METADATA_AGENT_ID = AgentsConversationEnvironmentKey.AGENT_ID;

    }

}